svm: use msr safe for erratum 383
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 11 Jun 2010 12:57:52 +0000 (13:57 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 11 Jun 2010 12:57:52 +0000 (13:57 +0100)
Make erratum 383 use msr safe variants to work on top of KVM.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
xen/arch/x86/hvm/svm/svm.c

index 3e022e19d0ae4f7684061099218eaf537dfd5351..c29ff34ea5e0880b88b6bed17b2113667c65e43c 100644 (file)
@@ -849,10 +849,14 @@ static void svm_init_erratum_383(struct cpuinfo_x86 *c)
     if ( c->x86 != 0x10 )
         return;
 
-    rdmsrl(MSR_AMD64_DC_CFG, msr_content);
-    wrmsrl(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47));
-
-    amd_erratum383_found = 1;
+    /* use safe methods to be compatible with nested virtualization */
+    if (rdmsr_safe(MSR_AMD64_DC_CFG, msr_content) == 0 &&
+        wrmsr_safe(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)) == 0)
+    {
+        amd_erratum383_found = 1;
+    } else {
+        printk("Failed to enable erratum 383\n");
+    }
 }
 
 static int svm_cpu_up(void)